package com.llf.Pojo;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

@Data
public class User implements Serializable
{

    private long    id;  //ID
    private String  userCode;   //用户编码
    private String  userName;   //用户名称
    private String  userPassword;   //用户密码
    private int     gender; //用户性别
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date    birthday; //用户生日
    private String  phone;//用户电话
    private String  address;//用户地址
    private Integer   userRole;//用户角色
    private Integer    createBy;//创建者
    private Date    creationDate;//创建时间
    private Integer    modifyBy;//更新者
    private Date    modifyDate;//更新时间

    private Integer age;//年龄

    public Integer getAge() {
        Date date=new Date();
        Integer age=date.getYear()-birthday.getYear();
        return age;
    }



    private String userRoleName;//用户角色名称

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getUserRoleName() {
        return userRoleName;
    }

    public void setUserRoleName(String userRoleName) {
        this.userRoleName = userRoleName;
    }

    public User() {
    }

    public User(long id, String userCode, String userName, String userPassword, int gender,
                Date birthday, String phone, String address, Integer userRole
               ) {
        this.id = id;
        this.userCode = userCode;
        this.userName = userName;
        this.userPassword = userPassword;
        this.gender = gender;
        this.birthday = birthday;
        this.phone = phone;
        this.address = address;
        this.userRole = userRole;

    }


}
